python calling dynamic function on object

53

python calling dynamic function on object -

obj = MyClass()
try:
    func = getattr(obj, "dostuff")
    func()
except AttributeError:
    print "dostuff not found"

Comments

Submit
0 Comments